import { reqAddressList, reqTradeInfo  } from "@/api"

const state = {
  address: [],
  tradeInfo: {}
}
const mutations = {
  GETADDRESSLIST(state, address) {
    state.address = address
  },
  GETTRADEINFO(state, tradeInfo) {
    state.tradeInfo = tradeInfo
  },
}
const actions = {
  async getAddressList ({commit}) {
    let result = await reqAddressList()
    if(result.code == 200) {
      commit('GETADDRESSLIST',result.data)
    }
  },
  // 获取商品清单
  async getTradeInfo({commit}) {
    let result = await reqTradeInfo()
    if (result.code == 200) {
      commit('GETTRADEINFO', result.data)
    }
  }
}
const getters = {}

export default {
  state,
  mutations,
  actions,
  getters
}